# !/usr/bin/env python3
# -*- coding: utf-8 -*-
# aim:    
# author: wangkaixuan
# email:  26554189525@qq.com 
# date:   2018/1/10

import socket
s = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
s.bind(('127.0.0.1',9999))
while True:
    data,addr = s.recvfrom(1024)
    print('Client addr:',addr)
    reply = 'Hello,%s!' % data.decode('utf-8')
    s.sendto(reply.encode('utf-8'),addr)